home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / EPISODE / JKM_PCG.GOO / cog_s1l2_elev_switch.cog < prev    next >
Text File  |  1998-02-25  |  2KB  |  101 lines

  1. # Jedi Knight Missions Cog 
  2. #
  3. # S1L2_elev_switch.cog
  4. #
  5. # [DS/RD/IS/JS/TL/SS}
  6. #
  7. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  8. # ========================================================
  9.  
  10. symbols
  11.  
  12. message    startup
  13. message damaged
  14. message    arrived
  15. message    killed
  16. message    timer
  17.  
  18. surface button            mask=0x448        linkid=1 
  19.  
  20. thing   elevator                   linkid=2
  21. thing    turret                        linkid=3
  22. thing    tank0                    linkid=2
  23. thing    tank1                    linkid=2
  24. thing    tank2
  25. thing    sparkspot                nolink
  26. thing    sparkspot1                nolink
  27.  
  28. template        spark=+sparks            local       
  29.  
  30. flex    start_wait=0.25                  desc=pause_before_moving_up
  31. flex    sleeptime=2.0
  32. flex    speed=4.0
  33.  
  34. flex    minimumDelay=2.0
  35. flex    maximumDelay=4.0
  36. flex    nextSpark=0.5                           local
  37.  
  38. int    targetframe                    local
  39. int    counter=0                    local
  40. int     player                                  local
  41.  
  42. template        spark=+sparks            local
  43.  
  44. #sound   wav0=Activate02.wav                  local        
  45. sound    kyleline        
  46.  
  47. end
  48.  
  49. # =========================================================
  50. code
  51. startup:
  52.     player=GetLocalPlayerThing();
  53.         AttachThingToThing(tank2, elevator);
  54.     AttachThingToThing(sparkspot1, elevator);
  55.         return;
  56.  
  57. damaged:                
  58.     if (GetSenderId() != 1) return;
  59.     if (GetWallCel(button) == 1) return;      
  60.        
  61.     if (GetSenderId() == 1) 
  62.     {
  63. //           SetWallCel(button, 1);
  64. //           PlaySoundPos(wav0, SurfaceCenter(button), 0.6, -1, -1, 0);
  65.         MoveToFrame(elevator, targetframe, speed);
  66.            SetTimer(nextspark);
  67.         sleep(2.0);
  68.         if (GetThingHealth(player) == 0) return;
  69.                 PlaySoundLocal(kyleline, 3.5, 0, 256);
  70.                 jkPrintUNIString(-1, 60069);
  71.         
  72.     }
  73.     return;
  74.  
  75. arrived:
  76.     counter = (counter + 1);
  77.     if ((counter % 8) >= 5) targetframe = (8 - (counter % 8));
  78.     else targetframe = (counter % 8);
  79.     MoveToFrame(elevator, targetframe, speed);
  80.     CreateThing(spark, sparkspot1);
  81.         return;
  82.  
  83. killed:
  84.     if (GetSenderId() == 3)
  85.     {
  86.         DamageThing(tank0, 100, 0, 0);
  87.         DamageThing(tank1, 100, 0, 0);
  88.     }
  89.     return;
  90.  
  91. timer:
  92.             
  93.         CreateThing(spark, sparkspot);
  94. //    PlaySoundThing(sparksound, sparkspot, 2, -1, -1, 0);
  95.     
  96.         nextSpark = minimumDelay + (Rand() * (maximumDelay - minimumDelay));
  97.     SetTimer(nextSpark);
  98.         return;
  99. end
  100.